// const CryptoJS = require('crypto-js');

function encrypt(page) {
    const _0x1575b7 = "oooooo"
    var _0x1167c7 = new Date().getTime();
    var u = ".mashangpa.com"
    var cookie = {
        "s": OOOoO(Sms + _0x1167c7)
    }
    return {
        'Header': {
            "Content-Type": "application/json",
            "Origin": "https://mashangpa.com",
            'M': OOOoOo(_0x1575b7 + _0x1167c7 + page, _0x1575b7),
            'T': btoa(_0x1167c7),
        },
        'param': {
            'page': page
        },
        'Cookie': cookie
    }
}

var mapping_dict = {
    "Zms": "log",
    "Ras": "; path=/;",
    "bms": "split",
    "hms": "parse",
    "pms": "error",
    "das": "method",
    "rms": "join",
    "jas": "url",
    "xms": "s=",
    "las": "xhrFields",
    "zms": "map",
    "Ams": "bugger",
    "tas": "Error fetching problem details:",
    "Cms": "from",
    "vas": "withCredentials",
    "Ims": "length",
    "Mms": "concat",
    "Oms": "de",
    "Qms": "stringify",
    "Eas": "POST",
    "Sms": "xoxoxoxo",
    "Gas": "headers",
    "Ums": "padStart",
    "Wms": "getTime",
    "Kas": "/data/",
    "Yms": "cookie",
    "_ms": "toString",
    "ams": "extend",
    "cms": "ajax",
    "ems": "\")()",
    "$ms": "fromCharCode",
    "oms": "Function(arguments[0]+\"",
    "qms": "addResponseInterceptor",
    "sms": "oooooo",
    "gas": "page",
    "ums": "我盯着你呢小子",
    "kas": "application/json",
    "yms": "slice",
    "mas": "Content-Type",
    "was": "/api/problem-detail/",
    "Dms": "success",
    "Fms": "charCodeAt",
    "Jms": "addRequestInterceptor",
    "Nms": "flat",
    "Pms": "forEach",
    "Tms": "hostname",
    "Has": "data",
    "Xms": "push",
    "Las": "status"
}
Object.assign(globalThis, mapping_dict)

function OOOoO(_0x4e90fb) {
    const _0x1c3852 = 4;
    const _0x1ba87b = groupMessage(_0x4e90fb, _0x1c3852);
    const _0x588ee8 = _0x1ba87b[zms](encryptGroup);
    const _0x391e71 = mergeGroups(_0x588ee8);
    const _0x45845b = toHexString(_0x391e71);
    return _0x45845b;
}

function OOOoOo(_0x240504, _0x8eefdc) {
    const _0x3a3671 = _0x240504[bms]("");
    const _0x1959d4 = _0x8eefdc[bms]("");
    const _0x582226 = 4;
    let _0x5ad857 = [];
    for (let _0x2d33d3 = 0; _0x2d33d3 < _0x3a3671[Ims]; _0x2d33d3 += _0x582226) {
        let _0x38ae5f = _0x3a3671[yms](_0x2d33d3, _0x2d33d3 + _0x582226);
        for (let _0x31873b = 0; _0x31873b < _0x38ae5f[Ims]; _0x31873b++) {
            const _0x11057a = _0x38ae5f[_0x31873b][Fms](0);
            const _0x1a6269 = _0x1959d4[_0x31873b % _0x1959d4[Ims]][Fms](0);
            const _0x25c979 = (_0x11057a + _0x1a6269) % 256;
            _0x38ae5f[_0x31873b] = String[$ms](_0x25c979);
        }
        _0x5ad857 = _0x5ad857[Mms](_0x38ae5f);
    }
    const _0x28d8b9 = _0x5ad857[rms]("");
    const _0x36bdd2 = Array[Cms](_0x28d8b9)[zms](_0x3c7e7a => _0x3c7e7a[Fms](0)[_ms](16)[Ums](2, "0"))[rms]("");
    return _0x36bdd2;
}

function groupMessage(_0x2dffee, _0x79d0b8) {
    const _0x135e82 = _0x2dffee[bms]("");
    const _0x1d7950 = [];
    for (let _0x2a5c42 = 0; _0x2a5c42 < _0x135e82[Ims]; _0x2a5c42 += _0x79d0b8) {
        _0x1d7950[Xms](_0x135e82[yms](_0x2a5c42, _0x2a5c42 + _0x79d0b8));
    }
    return _0x1d7950;
}

function mergeGroups(_0x264398) {
    return _0x264398[Nms]()[rms]("");
}

function toHexString(_0x1ebd7f) {
    return Array[Cms](_0x1ebd7f)[zms](_0xc67c4c => _0xc67c4c[Fms](0)[_ms](16)[Ums](2, "0"))[rms]("");
}

function encryptGroup(_0x555578) {
    return _0x555578[zms](_0x538aee => {
        const _0x16263a = _0x538aee[Fms](0);
        let _0x1d0d16 = _0x16263a;
        _0x1d0d16 = _0x1d0d16 << 3 | _0x1d0d16 >>> 5;
        _0x1d0d16 ^= 90;
        _0x1d0d16 = _0x1d0d16 << 2 | _0x1d0d16 >>> 6;
        _0x1d0d16 ^= 63;
        _0x1d0d16 = _0x1d0d16 % 256;
        return String[$ms](_0x1d0d16);
    });
}

module.default = {encrypt}